package fr.mmt.gisfizz.repository;

import fr.mmt.gisfizz.entity.Role;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

/**
 * Role repository.
 *
 * @author Mathieu MAST
 */
public interface RoleRepository extends JpaRepository<Role, String> {

    @Query("select e from Role e WHERE lower(e.code) like :search OR lower(e.label) like :search")
    public Page<Role> search(@Param("search") String search, Pageable page);
}
